package com.example.film.controller;


import com.example.film.entity.FillingCompany;
import com.example.film.entity.FilmSchedule;
import com.example.film.service.FilmScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;
import java.util.List;

@Api(tags = "电影排片信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("schedule/v1")
public class FilmScheduleController {

    @Autowired
    private FilmScheduleService filmScheduleService;

    @ApiOperation("电影排片信息")
    @GetMapping("/filmSession")
    public List<FilmSchedule> getFilmSchedule(){
        return filmScheduleService.findFilmSchedule();
    }

    @ApiOperation("分页查询电影排片信息")
    @GetMapping("/sessionInfo")
    public List<FilmSchedule> getFilmScheduleInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return filmScheduleService.findFilmScheduleInfo(pageNum, pageSize);
    }

    @ApiOperation("根据日期查找电影排片信息")
    @GetMapping("/currentDate/{date}")
    public List<FilmSchedule> getFilmScheduleByDate(@PathVariable Date date){
        return filmScheduleService.findFilmScheduleByDate(date);
    }

    @ApiOperation("根据日期查找总排片前十电影排片信息")
    @GetMapping("/date/{date}")
    public List<FilmSchedule> getScheduleInfoByDate(@PathVariable Date date){
        return filmScheduleService.findScheduleInfoByDate(date);
    }

    @ApiOperation("影片排片统计信息")
    @GetMapping("/sumSession")
    public List<FilmSchedule> getFilmSumSession(){
        return filmScheduleService.findFilmSumSession();
    }

    @ApiOperation("影片类型排片统计信息")
    @GetMapping("/typeSession")
    public List<FilmSchedule> getTypeSumSession(){
        return filmScheduleService.findTypeSumSession();
    }
}
